
/**************************************************************************************************/
#ifndef PWM_H
#define PWM_H

/* ------------------------------------------------------------------------------------------------
 *                                          Includes
 * ------------------------------------------------------------------------------------------------
 */

// Convenience to minimize the include files in each module.
#include "hal_defs.h"
#include "hal_types.h"

#include "zaccel.h"

/* ------------------------------------------------------------------------------------------------
 *                                          Constants
 * ------------------------------------------------------------------------------------------------
 */

#define PWM_CONF         0x0000
/*
#define PWM_MINPULSE  500
#define PWM_MAXPULSE  2500

#define PWM_PULSE_STEP 100
*/

#define  PWM_MAX    20000

#define APP_MOVE_INTERVAL 2

/* ------------------------------------------------------------------------------------------------
 *                                          Types
 * ------------------------------------------------------------------------------------------------
 */

typedef struct pwmMsg_t
{
  int16 left;
  int16 right;
  int16 time;
} pwmMsg_t;


/* ------------------------------------------------------------------------------------------------
 *                                          Macros
 * ------------------------------------------------------------------------------------------------
 */


/* ------------------------------------------------------------------------------------------------
 *                                           Global Variables
 * ------------------------------------------------------------------------------------------------
 */


/* ------------------------------------------------------------------------------------------------
 *                                          Functions
 * ------------------------------------------------------------------------------------------------
 */
void pwmStop(void);

/**************************************************************************************************
 * @fn          pwmInit
 *
 * @brief       This function initializes the PWM output
 *
 * input parameters
 *
 * None.
 *
 * output parameters
 *
 * None.
 *
 * @return      None.
 **************************************************************************************************
 */
void pwmInit(void);


void pwmSet(int16 left, int16 right, int16 time);

void appProcessPwmMessage(uint16 source, uint16 command, uint8 len, uint8 *pData);

#endif
